<template>
  <div>
    <h1>我是手写的下拉页面</h1>
    <Tree :treeData="treeData" :selected_id="selected_id" @tree-click="handleTreeClick"></Tree>
   <div>
    <!-- <Node v-for="treeNode in treeData" :key="treeNode.id" :selected_id="selected_id" :node="treeNode" @node-click="handleClick"></Node> -->
   </div>
  </div>
</template>
<script>
// import Node from '@/components/Node.vue';
import Tree from '../components/tree/index.vue'
export default {
  components: {
    // TreeSelect,
    Tree
  },
  watch: {
    treeValue(val) {
      console.log(val, '======');

    }
  },
  data() {
    return {
      treeData: [
        {
          label: '测试1',
          id: "1",
          children: [
            {
              label: '测试1-1',
              id: "1-1"
            },
            {
              label: '测试1-2',
              id: "1-2",
              children: [
                {
                  label: '测试1-2-1',
                  id: "1-2-1"
                }
              ]
            }
          ]
        },
        {
          label: '测试2',
          id: "2",
          children: []
        }
      ],
      selected_id: '',
      msg: '',
      arr: []
    }
  },
  methods: {
    handleTreeClick(node) {
      this.selected_id = node.id
      console.log('当前选中为', this.selected_id); 
    }
  },
  beforeUpdate() {
    this.arr = []
    console.log('死循环');
  },
  updated() {
    this.msg = "666"
    console.log('updated调用');
    
  }
}
</script>
<style lang="less"></style>